"use strict";

const BaseModel = require("../basics/mysql/mapper");

class HomeModel extends BaseModel {
  constructor(cloud) {
    super(cloud, "nk_wuser", false);
  }

  /**
   * 获取实例
   * @param {*} cloud 
   */
  static getInstant(cloud) {
    return new HomeModel(cloud);
  }

  /**
 * 查询白名单
 * @param {String} userNick 
 */
  async selectIsExistByUserNick(userNick) {
    const ex = this.createExample();
    ex.criteria.andEqual("userNick", userNick);
    const count = await this.selectCountByExample(ex);
    if (count > 0) {
      return true;
    }
    return false;
  }

}

module.exports = HomeModel;